package com.cheng.event;

import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

@Component
public class SignPublisher {

    private final ApplicationContext applicationContext;

    public SignPublisher(ApplicationContext applicationContext) {
        this.applicationContext = applicationContext;
        System.out.println("当前时间发布核心类application context" + applicationContext);
    }

    public void publisher(String message) {
        System.out.println(this);
        applicationContext.publishEvent(new SignEvent(this, message));
    }

}
